<div class="row">
    <div class="col-sm-3">
        <?php echo ws_load_content('contents/account_sidebar'); ?>
    </div>
    <div class="col-sm-9">
        <div class="page-header">
            <h4>个人设置
                <small>修改密码及用户名</small>
            </h4>
        </div>
        <div class="">

            <?php if ($error) { ?>
                <div class="alert alert-danger">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                    <p><?php echo $error; ?></p>
                </div>
            <?php } ?>

            <?php if ($this->session->flashdata('SUCCESS')) { ?>
                <div class="alert alert-success">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                    <p><?php echo $this->session->flashdata('SUCCESS'); ?></p>
                </div>
            <?php } ?>

            <?php echo form_open('', 'class="form-horizontal" role="form"'); ?>
            <?php $name_error = form_error('user_name', NULL, NULL); ?>
            <div class="form-group <?php echo($name_error ? 'has-error' : '') ?>">
                <label for="user_name" class="col-sm-3 control-label">用户名</label>

                <div class="col-sm-9">
                    <input type="user_name" class="form-control input-sm" id="user_name" name="user_name"
                           value="<?php echo set_value('user_name', (!isset($_POST['user_name']) ? $this->user->get_value('user_name') : '')); ?>"
                           placeholder="Full Name">
                    <?php if ($name_error) { ?>
                        <p class="help-block help-block-sm"><?php echo $name_error; ?></p>
                    <?php } ?>
                </div>
            </div>
            <div class="form-group">
                <label for="" class="col-sm-3 control-label">公开邮箱?</label>

                <div class="col-sm-9">
                    <label class="checkbox-inline" for="user_public_profile">
                        <input <?php echo set_checkbox('user_public_profile', '1', ($this->user->get_value('user_public_profile') ? TRUE : FALSE)); ?>
                            name="user_public_profile" type="checkbox" id="user_public_profile" value="1"> yes
                    </label>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-3 col-sm-9">
                    <button type="submit" name="profile_update" class="btn btn-default  btn-sm"><i
                            class="fa fa-save"></i> 修改
                    </button>
                </div>
            </div>
            <?php echo form_close(); ?>
            <hr/>
            <?php echo form_open('', 'class="form-horizontal" role="form"'); ?>
            <?php $old_pass_error = form_error('old_password', NULL, NULL); ?>
            <div class="form-group <?php echo($old_pass_error ? 'has-error' : '') ?>">
                <label for="old_password" class="col-sm-3 control-label">旧密码</label>

                <div class="col-sm-9">
                    <input type="password" name="old_password"
                           value="<?php echo set_value('old_password'); ?>"
                           class="form-control input-sm" id="old_password">
                    <?php if ($old_pass_error) { ?>
                        <p class="help-block help-block-sm"><?php echo $old_pass_error; ?></p>
                    <?php } ?>
                </div>
            </div>
            <?php $pass_error = form_error('user_password', NULL, NULL); ?>
            <div class="form-group <?php echo($pass_error ? 'has-error' : '') ?>">
                <label for="user_password" class="col-sm-3 control-label">新密码</label>

                <div class="col-sm-9">
                    <input type="password" name="user_password"
                           value="<?php echo set_value('user_password'); ?>"
                           class="form-control input-sm" id="user_password">
                    <?php if ($pass_error) { ?>
                        <p class="help-block help-block-sm"><?php echo $pass_error; ?></p>
                    <?php } ?>
                </div>
            </div>
            <?php $passRe_error = form_error('re_user_password', NULL, NULL); ?>
            <div class="form-group <?php echo($passRe_error ? 'has-error' : '') ?>">
                <label for="re_user_password" class="col-sm-3 control-label">重复新密码</label>

                <div class="col-sm-9">
                    <input type="password" name="re_user_password"
                           value="<?php echo set_value('re_user_password'); ?>"
                           class="form-control input-sm" id="re_user_password">
                    <?php if ($passRe_error) { ?>
                        <p class="help-block help-block-sm"><?php echo $passRe_error; ?></p>
                    <?php } ?>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-3 col-sm-9">
                    <button type="submit" name="password_update" class="btn btn-default btn-sm"><i
                            class="fa fa-save"></i> 修改密码
                    </button>
                </div>
            </div>
            <?php echo form_close(); ?>
        </div>
    </div>
</div>